//
//  UserQuestViewController.m
//  YuTang
//
//  Created by 葛悦彣 on 2024/10/22.
//

#import "UserQuestViewController.h"
#import "myQuestViewController.h"

@interface UserQuestViewController ()
@property (nonatomic ,strong)  myQuestViewController * myvc;

@end

@implementation UserQuestViewController


- (void)viewDidLoad {
    [super viewDidLoad];
    self.shutDownBack = YES;
    
    UIView * topview = [UIView new];
    topview.backgroundColor = KcolorHex(@"#0967FF");
    [self.view addSubview:topview];
    [topview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.offset(0);
        make.height.offset(Knav_HeightX );
    }];
    MJWeakSelf
    UIView * backview = [UIView new].addClickBlock(^{
        [weakSelf popViewController];
    });
    [topview addSubview:backview];
    [backview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.offset(44 + 10);
        make.left.bottom.offset(0);
        make.width.offset(kwt(170));
    }];
    
    UIImageView * leftimg = kimageView(@"white_path");
    [backview addSubview:leftimg];
    [leftimg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.height.offset(20);
        make.left.offset(kwt(10));
        make.centerY.offset(0);
    }];
    
    UILabel * leftlab = [DTKTool labelWithText:@"他的任务" andFont:kCFont(18) andTextColor:UIColor.whiteColor];
    [backview addSubview:leftlab];
    [leftlab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(kwt(43));
        make.centerY.offset(0);
    }];
    
    if([self.userId isEqualToString:[UserInfoModel shared].userID]){
        leftlab.text = @"我的任务";
    }
  
    
    myQuestViewController * myvc = [myQuestViewController new];
    self.myvc = myvc;
    myvc.state = self.state;
    myvc.user = self.user;
    myvc.userId = self.userId;
    myvc.userName = self.userName;
    [self.view addSubview:myvc.view];
    [self addChildViewController:myvc];
    [myvc.view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.bottom.right.offset(0);
        make.top.equalTo(topview.mas_bottom);
    }];

}
@end
